<!--
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-05-18 11:26:28
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-08-29 14:30:18
 * @FilePath: \cxl-h5\src\pages\noPermission\Index.vue
-->
<template>
    <section class="no-permission">
        <section>
            <img src="../../assets/images/zanwuquanxian.png" alt="" />
            <p>您没有权限访问！</p>
            <p>{{ count }} 秒后返回首页</p>
        </section>
    </section>
</template>

<script setup lang="ts">
import useWeixinSdk from '@/utils/WXSdk'
import { onUnmounted } from 'vue'
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
// import router from '@/router'

const router = useRouter()
//设置 5 秒倒计时
const count = ref(5)

let timer = setInterval(() => {
    count.value--
    if (count.value === 0) {
        router.replace('/index')
        clearInterval(timer)
    }
}, 1000)
onMounted(() => {
    useWeixinSdk.disableShare()
})
onUnmounted(() => {
    if (timer) {
        clearInterval(timer)
    }
})
</script>

<style scoped lang="scss">
.no-permission {
    min-height: 100vh;
    justify-content: center;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;

    img {
        display: inline;
        width: 50%;
    }
    p {
        margin-top: var(--cxl-size-12);
        font-size: var(--cxl-size-12);
    }
}
</style>
